package com.itheima.app.controller;

import com.itheima.app.manager.SoundManager;
import org.omg.CORBA.PUBLIC_MEMBER;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
public class SoundController {


    @Autowired
    SoundManager soundManager;

    /**
     * 发送语音
     * @param soundFile
     */
    @PostMapping("/peachblossom")
    public void sendSound(MultipartFile soundFile) throws IOException {
        soundManager.sendSound(soundFile);
    }


    /**
     * 接收语音
     * @return
     */
    @GetMapping("/peachblossom")
    public ResponseEntity acceptSound(){
        return soundManager.acceptSound();
    }
}
